package com.ruoyi.settled.domain;

import com.github.wxpay.sdk.WXPayConfig;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import java.io.InputStream;

@Configuration
public class WechatPayConfig implements WXPayConfig {

    @Value("${wechatpay.app-id}")
    private String appId;

    @Value("${wechatpay.mch-id}")
    private String mchId;

    @Value("${wechatpay.api-key}")
    private String apiKey;

    @Value("${wechatpay.notify-url}")
    private String notifyUrl;

    @Value("${wechatpay.trade-type}")
    private String tradeType;

    // Getters
    public String getAppId() {
        return appId;
    }

    public String getMchId() {
        return mchId;
    }

    public String getApiKey() {
        return apiKey;
    }

    public String getNotifyUrl() {
        return notifyUrl;
    }

    public String getTradeType() {
        return tradeType;
    }

    @Override
    public String getAppID() {
        return appId;
    }

    @Override
    public String getMchID() {
        return mchId;
    }

    @Override
    public String getKey() {
        return apiKey;
    }

    @Override
    public InputStream getCertStream() {
        return null; // 如果需要使用证书，请返回证书的InputStream
    }

    @Override
    public int getHttpConnectTimeoutMs() {
        return 8000;
    }

    @Override
    public int getHttpReadTimeoutMs() {
        return 10000;
    }
}